package org.chungyan5.mnt.controller;

import org.chungyan5.mnt.model.Item2MntTagTableRecycle;
import org.chungyan5.mnt.model.ItemRecycle;
import org.chungyan5.mnt.model.MNTTagRecycle;
import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.datastore.Datastore;

import com.google.appengine.repackaged.org.json.JSONObject;

public class ClrRecycleBoxesController extends Controller {

    @Override
    public Navigation run() throws Exception {
    	
        // remove all Recycle Tables ======================
        Datastore.delete(Datastore.query(MNTTagRecycle.class).asKeyList());
        Datastore.delete(Datastore.query(ItemRecycle.class).asKeyList());
        Datastore.delete(Datastore.query(Item2MntTagTableRecycle.class).asKeyList());
        
        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");
        response.getWriter().write(new JSONObject().put("status", "ok").toString());

        return null;
    }
}
